package ro.msg.quiz.App;

import java.awt.EventQueue;
import java.util.ArrayList;

import ro.msg.quiz.Model.IQuizModel;
import ro.msg.quiz.Model.QuizModel;
import ro.msg.quiz.controller.Controller;
import ro.msg.quiz.controller.QuizController;
import ro.msg.quiz.repository.Question;
import ro.msg.quiz.repository.Quiz;
import ro.msg.quiz.repository.RepositoryQuestion;
import ro.msg.quiz.repository.RepositoryQuiz;
import ro.msg.quiz.view.MainWindow;
import ro.msg.quiz.view.NoGUIview;

public class StartApp {

	/**
	 * @param args
	 */
	@SuppressWarnings("deprecation")
	public static void main(String[] args) {
		ArrayList<Question> questionsList = new ArrayList<Question>();
		ArrayList<Quiz> quizList = new ArrayList<Quiz>();
		RepositoryQuestion repoQuestion = new RepositoryQuestion(questionsList);
		RepositoryQuiz repoQuiz = new RepositoryQuiz(quizList);
		final IQuizModel model = new QuizModel(repoQuestion, repoQuiz);
		QuizController ctrl = new QuizController(model);
		final Controller guiController = new Controller(model);
		NoGUIview v = new NoGUIview(ctrl);
		// starts the GUI
		EventQueue.invokeLater(new Runnable() {
			@Override
			public void run() {
				try {
					MainWindow main = new MainWindow(guiController);
					main.setVisible(true);

				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
		v.showUI();
		// v.showUI();
	}

}